//
//  WYPayMethod.h
//  WithYou
//
//  Created by edz on 2020/7/27.
//  Copyright © 2020 郭子一. All rights reserved.
//

#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN

@interface PayAlipayData : NSObject
@property (nonatomic, copy) NSString *orderSpec;
@end

@interface PayWeChatData : NSObject
@property (nonatomic, copy) NSString *partnerId;
@property (nonatomic, copy) NSString *prepayId;
@property (nonatomic, copy) NSString *package;
@property (nonatomic, copy) NSString *nonceStr;
@property (nonatomic, assign) UInt32 timeStamp;
@property (nonatomic, copy) NSString *sign;
@end

/**
 *  支付结果码
 */
typedef NS_ENUM(NSUInteger, PayResultCode) {
    /**
     *  成功
     */
    PayResultCodeSuccess,
    /**
     *  失败
     */
    PayResultCodeFailure,
    /**
     *  用户取消
     */
    PayResultCodeUserCancel,
    /**
     *  处理中
     */
    PayResultCodeProcessing,
};

typedef void(^PayCompleteCallBack)(NSString *result, NSString *message, PayResultCode code);

@interface WYPayMethodManager : NSObject
///初始化部分
+ (void)ready;
+ (BOOL)handleUrl:(NSURL *)url;

///是否安装微信客户端
+ (BOOL)isInstallWeChat;
///是否安装支付宝客户端
+ (BOOL)isInstallAlipay;
///支付
+ (void)useAlipayPayOrderForOrderData:(PayAlipayData *)orderData callBack:(PayCompleteCallBack)callBack;
+ (void)useWeChatPayOrderForOrderData:(PayWeChatData *)orderData callBack:(PayCompleteCallBack)callBack;
@end

NS_ASSUME_NONNULL_END
